// package com.jxb.config;
//
// import org.apache.http.HttpHost;
// import org.apache.http.auth.AuthScope;
// import org.apache.http.auth.UsernamePasswordCredentials;
// import org.apache.http.client.CredentialsProvider;
// import org.apache.http.impl.client.BasicCredentialsProvider;
// import org.elasticsearch.client.RestClient;
// import org.elasticsearch.client.RestHighLevelClient;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
//
// /**
//  * es 连接安全配置
//  *
//  * @author jiaobo
//  * @date Created in 2024/9/27 19:56
//  **/
// @Configuration
// public class AuthConfig {
//
//     @Bean
//     public RestHighLevelClient client() {
//         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
//         credentialsProvider.setCredentials(
//                 AuthScope.ANY,
//                 new UsernamePasswordCredentials("elastic", "19970719bo")
//         );
//
//         return new RestHighLevelClient(
//                 RestClient.builder(
//                                 new HttpHost("192.168.159.144", 9200, "http"),
//                                 new HttpHost("192.168.159.145", 9200, "http"),
//                                 new HttpHost("192.168.159.146", 9200, "http")
//                         )
//                         .setHttpClientConfigCallback(httpClientBuilder ->
//                                                              httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider))
//         );
//     }
//
// }
